using Munim.Fame.DataAccess.NHibernate.Configurations;
using Munim.Fame.DataAccess.NHibernate.Configurations.Interfaces;
using Munim.Fame.DataAccess.Ninject.Modules;
using NHibernate;
using Ninject;
using Ninject.Activation;

namespace Munim.Fame.DataAccess.Ninject.Providers
{
    public class SessionFactoryProvider : Provider<ISessionFactory>
    {
        protected override ISessionFactory CreateInstance(IContext context)
        {
            var sessionConfiguration = context.Kernel.Get<ISessionConfiguration>();
            return sessionConfiguration.GetConfiguration().BuildSessionFactory();
        }
    }
}